<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title><?php echo C('TITLE');?></title>
	<meta name="keywords" content="<?php echo C('KEYWORD');?>" />
	<meta name="description" content="<?php echo C('DESCRIPTION');?>" />
	<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
	<meta name="apple-touch-fullscreen" content="yes">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="email=no">
	<meta name="format-detection" content="address=no">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/Public/mobile/css/base.css">
	<link rel="stylesheet" href="/Public/mobile/css/index.css">
	<link rel="stylesheet" type="text/css" href="/Public/mobile/css/main.css">
</head>

<script src="/Public/mobile/ICalendar/js/lCalendar.js"></script>
<link rel="stylesheet" href="/Public/mobile/ICalendar/css/lCalendar.css">

<body>

  <!--通用头部-->
  <div class="page-header" style="margin:0">
  <div class="logo">
    <a href="/">
      <img src="/Public/mobile/img/logo.png" alt="大众搬家">
    </a>
  </div>
  <div class="city-box" id="cityBox">
    <i class="icon-city"></i>
    <span class="city js-topCity">深圳</span>
    <i class="icon-arrow"></i>
    <div class="city-other js-topOtherCity">广州</div>
  </div>
</div>

  <!-- start 预约搬家 -->
  <div class="js-page page-form">
    <p class="page-form-title">请填写您的下单信息：</p>
    <form id="Order_Form">
      <div class="form-group">
        <label for="">套餐选择</label>
        <div class="form-controls">
          <select class="ipt-select" id="tcxz" name="tcxz">
            <option <?php if($type == 2): ?>selected="selected"<?php endif; ?> value="手拉手套餐">手拉手套餐</option>
            <option <?php if($type == 3): ?>selected="selected"<?php endif; ?> value="小家庭套餐">小家庭套餐</option>
            <option <?php if($type == 4): ?>selected="selected"<?php endif; ?> value="大家庭套餐">大家庭套餐</option>
          </select>
        </div>
      </div>
      <div class="form-group">
        <label for="">搬家时间</label>
        <div class="form-controls">
          <input type="text" value="" id="bjsj" name="bjsj" data-lcalendar="2000-01-1,2020-12-31">
        </div>
      </div>
      <div class="form-group">
        <label for="">起点地址</label>
        <div class="form-controls">
          <input type="text" value="" id="qddz" name="qddz" placeholder="请输入您的搬家起点地址">
        </div>
      </div>
      <div class="form-group">
        <label for="">新居地址</label>
        <div class="form-controls">
          <input type="text" value="" id="xjdz" name="xjdz" placeholder="请输入您的搬家目的地">
        </div>
      </div>
      <div class="form-group">
        <label for="">联系电话</label>
        <div class="form-controls">
          <input type="tel" value="" id="lxdh" name="lxdh" placeholder="请输入您的手机号" id="contactPhone" maxlength="11">
        </div>
      </div>
      <div class="form-group">
        <label for="">物品描述</label>
        <div class="form-controls">
          <textarea id="fpms" name="fpms" placeholder="空调，冰箱，电视，洗衣机，床，家具，沙发，衣柜等" rows="4"></textarea>
        </div>
      </div>

      <div class="order-btn-group">
        <span class="order-btn" id="order_submit" style="display:null;padding:0">预约搬家</span>
      </div>
    </form>
  </div>
  <!-- end 预约搬家 -->

  <!-- start 底部导航条 -->
  <ul class="bottom-nav-wrap">
  <li>
    <a href="<?php echo U('mobile/index');?>">
      <i class="bottom-nav-icon nav-icon1"></i>
      <p>搬家套餐</p>
    </a>
  </li>
  <li>
    <a href="<?php echo U('mobile/pack');?>">
      <i class="bottom-nav-icon nav-icon3"></i>
      <p>打包还原</p>
    </a>
  </li>
  <li>
    <a href="<?php echo U('mobile/evaluate');?>">
      <i class="bottom-nav-icon nav-icon4"></i>
      <p>客户评价</p>
    </a>
  </li>
</ul>
  <!-- start 底部导航条 -->

  <script src="/Public/mobile/js/jquery.js"></script>
<script src="/Public/mobile/js/index.js"></script>
  <script>
    $('.bottom-nav-wrap li').eq(0).addClass('active');
  </script>
  <script type="text/javascript" src="/Public/javascripts/admin/jquery.form.js"></script>
  <script type="text/javascript" src="/Public/skin/layer/layer.js"></script>
  <script type="text/javascript" src="/Public/skin/functions.js"></script>
  <script type="text/javascript">
    var calendardatetime = new lCalendar();
    calendardatetime.init({
      'trigger': '#bjsj',
      'type': 'datetime'
    });

    $(function () {
      // 提交
      $("#order_submit").click(function () {
        if ($("#bjsj").val() == '') {
          layer.alert('请选择搬家时间！', {
            icon: 2,
            closeBtn: 0
          });
          $('#bjsj').focus();
          return false;
        }
        
        if ($("#qddz").val() == '') {
          layer.alert('请输入起点地址！', {
            icon: 2,
            closeBtn: 0
          });
          $('#qddz').focus();
          return false;
        }
        
        if ($("#xjdz").val() == '') {
          layer.alert('请输入新居地址！', {
            icon: 2,
            closeBtn: 0
          });
          $('#xjdz').focus();
          return false;
        }
        
        if ($("#lxdh").val() == '') {
          layer.alert('请输入联系电话！', {
            icon: 2,
            closeBtn: 0
          });
          $('#lxdh').focus();
          return false;
        }
        
        if (!isMobile($("#lxdh").val())) {
          layer.alert('请输入合法的联系电话！',{icon: 2,closeBtn: 0});
          $('#lxdh').focus();
          return false;
        } 
        
        if ($("#fpms").val() == '') {
          layer.alert('请输入物品描述！', {
            icon: 2,
            closeBtn: 0
          });
          $('#fpms').focus();
          return false;
        }
        
        var url = "<?php echo U('order/submit');?>";
        $('#Order_Form').ajaxSubmit({
          url: url,
          type: "POST",
          success: function (data, st) {
            if (data.status) {
              if (data.url && data.url != '') {
                layer.confirm(data.info, {
                  btn: ['确定'],
                  icon: 1,
                  closeBtn: 0
                }, function () {
                  window.location.href = data.url;
                });
              } else {
                //$('#tcxz').val('');
                $('#bjsj').val('');
                $('#qddz').val('');
                $('#xjdz').val('');
                $('#lxdh').val('');
                $('#fpms').val('');
                layer.alert(data.info, {icon: 1,closeBtn: 0});
              }
            } else {
              layer.alert(data.info, {
                icon: 2,
                closeBtn: 0
              });
            }
          }
        });
      });
    });
  </script>
</body>

</html>